package demo1;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: 石方旭
 * Date: 2022-07-01
 * Time: 21:29
 */
public class TestBinaryTree {

    public static void main(String[] args) {
         int[] array = {5,3,4,1,7,8,2,6,0,9};
         BinarySearchTree binarySearchTree = new BinarySearchTree();
         for(int i =0;i< array.length;++i){
             binarySearchTree.insert(array[i]);
         }
         for(int i =0;i< array.length;++i){
            System.out.print(binarySearchTree.search(array[i])+" ");
         }
         System.out.println(binarySearchTree.search(90));
         System.out.println("===============");
         binarySearchTree.remove(5);
         binarySearchTree.remove(4);
         binarySearchTree.remove(3);
         binarySearchTree.remove(1);
         binarySearchTree.remove(7);
         binarySearchTree.remove(8);
         binarySearchTree.remove(2);
         binarySearchTree.remove(6);
         binarySearchTree.remove(0);
         binarySearchTree.remove(9);
        for(int i =0;i< array.length;++i){
            System.out.print(binarySearchTree.search(array[i])+" ");
        }
    }

}
